From 626f27f7ed90bef4280ee0248a4fb565b7d0012f Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Mon, 29 Nov 2010 16:29:09 +0900 Subject: [PATCH] Changed cell area/renderer "can_focus" semantics to "is_activatable" across the board. This is because focus in treeviews can be given to cells that cannot do anything with activation (for better keynav), so we dissociate the concept of cell activation and focusing. --- gtk/gtkcellarea.c | 34 +++++++++++++++++----------------- gtk/gtkcellarea.h | 8 ++++---- gtk/gtkcellareabox.c | 2 +- gtk/gtkcellrenderer.c | 8 ++++---- gtk/gtkcellrenderer.h | 2 +- gtk/gtktreeview.c | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 2b07e87048..386af0cceb 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -356,7 +356,7 @@ static void gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea gint height, gint *minimum_width, gint *natural_width); -static gboolean gtk_cell_area_real_can_focus (GtkCellArea *area); +static gboolean gtk_cell_area_real_is_activatable (GtkCellArea *area); static gboolean gtk_cell_area_real_activate (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, @@ -553,9 +553,9 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) class->get_preferred_width_for_height = gtk_cell_area_real_get_preferred_width_for_height; /* focus */ - class->can_focus = gtk_cell_area_real_can_focus; - class->focus = NULL; - class->activate = gtk_cell_area_real_activate; + class->is_activatable = gtk_cell_area_real_is_activatable; + class->activate = gtk_cell_area_real_activate; + class->focus = NULL; /* Signals */ /** @@ -990,18 +990,18 @@ gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea *area, } static void -get_can_focus (GtkCellRenderer *renderer, - gboolean *can_focus) +get_is_activatable (GtkCellRenderer *renderer, + gboolean *activatable) { - if (gtk_cell_renderer_can_focus (renderer)) - *can_focus = TRUE; + if (gtk_cell_renderer_is_activatable (renderer)) + *activatable = TRUE; } static gboolean -gtk_cell_area_real_can_focus (GtkCellArea *area) +gtk_cell_area_real_is_activatable (GtkCellArea *area) { - gboolean can_focus = FALSE; + gboolean activatable = FALSE; /* Checks if any renderer can focus for the currently applied * attributes. @@ -1009,9 +1009,9 @@ gtk_cell_area_real_can_focus (GtkCellArea *area) * Subclasses can override this in the case that they are also * rendering widgets as well as renderers. */ - gtk_cell_area_forall (area, (GtkCellCallback)get_can_focus, &can_focus); + gtk_cell_area_forall (area, (GtkCellCallback)get_is_activatable, &activatable); - return can_focus; + return activatable; } static gboolean @@ -2326,20 +2326,20 @@ gtk_cell_area_cell_get_property (GtkCellArea *area, *************************************************************/ /** - * gtk_cell_area_can_focus: + * gtk_cell_area_is_activatable: * @area: a #GtkCellArea * - * Returns whether the area can receive keyboard focus, + * Returns whether the area can do anything when activated, * after applying new attributes to @area. * - * Returns: whether @area can receive focus. + * Returns: whether @area can do anything when activated. */ gboolean -gtk_cell_area_can_focus (GtkCellArea *area) +gtk_cell_area_is_activatable (GtkCellArea *area) { g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE); - return GTK_CELL_AREA_GET_CLASS (area)->can_focus (area); + return GTK_CELL_AREA_GET_CLASS (area)->is_activatable (area); } /** diff --git a/gtk/gtkcellarea.h b/gtk/gtkcellarea.h index 5611e65845..abc73d0479 100644 --- a/gtk/gtkcellarea.h +++ b/gtk/gtkcellarea.h @@ -144,7 +144,7 @@ struct _GtkCellAreaClass GParamSpec *pspec); /* Focus */ - gboolean (* can_focus) (GtkCellArea *area); + gboolean (* is_activatable) (GtkCellArea *area); gboolean (* focus) (GtkCellArea *area, GtkDirectionType direction); gboolean (* activate) (GtkCellArea *area, @@ -285,14 +285,14 @@ void gtk_cell_area_cell_get_property (GtkCellArea /* Focus */ -gboolean gtk_cell_area_can_focus (GtkCellArea *area); -gboolean gtk_cell_area_focus (GtkCellArea *area, - GtkDirectionType direction); +gboolean gtk_cell_area_is_activatable (GtkCellArea *area); gboolean gtk_cell_area_activate (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, const GdkRectangle *cell_area, GtkCellRendererState flags); +gboolean gtk_cell_area_focus (GtkCellArea *area, + GtkDirectionType direction); void gtk_cell_area_set_focus_cell (GtkCellArea *area, GtkCellRenderer *renderer); GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area); diff --git a/gtk/gtkcellareabox.c b/gtk/gtkcellareabox.c index a95bc789a5..9d4bcbdae6 100644 --- a/gtk/gtkcellareabox.c +++ b/gtk/gtkcellareabox.c @@ -1138,7 +1138,7 @@ gtk_cell_area_box_render (GtkCellArea *area, /* If no cell can activate but the caller wants focus painted, * then we paint focus around all cells */ - if (paint_focus && !gtk_cell_area_can_focus (area)) + if (paint_focus && !gtk_cell_area_is_activatable (area)) focus_all = TRUE; } diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c index d7b77ed364..dcbb668948 100644 --- a/gtk/gtkcellrenderer.c +++ b/gtk/gtkcellrenderer.c @@ -1104,17 +1104,17 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell) /** - * gtk_cell_renderer_can_focus: + * gtk_cell_renderer_is_activatable: * @cell: A #GtkCellRenderer * - * Checks whether the cell renderer can receive focus. + * Checks whether the cell renderer can do something when activated. * - * Returns: %TRUE if the cell renderer can do anything with keyboard focus + * Returns: %TRUE if the cell renderer can do anything when activated. * * Since: 3.0 */ gboolean -gtk_cell_renderer_can_focus (GtkCellRenderer *cell) +gtk_cell_renderer_is_activatable (GtkCellRenderer *cell) { GtkCellRendererPrivate *priv; diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h index 03d9df5130..22e86379cf 100644 --- a/gtk/gtkcellrenderer.h +++ b/gtk/gtkcellrenderer.h @@ -247,7 +247,7 @@ void gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell, gboolean sensitive); gboolean gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell); -gboolean gtk_cell_renderer_can_focus (GtkCellRenderer *cell); +gboolean gtk_cell_renderer_is_activatable (GtkCellRenderer *cell); /* For use by cell renderer implementations only */ void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell, diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 2e7dc3b3be..5c4c073e7a 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -7804,7 +7804,7 @@ gtk_tree_view_has_can_focus_cell (GtkTreeView *tree_view) if (!gtk_tree_view_column_get_visible (column)) continue; - if (gtk_cell_area_can_focus (column->cell_area)) + if (gtk_cell_area_is_activatable (column->cell_area)) return TRUE; } -- 2.30.2